﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Cinemax.DTO
{
    public class VeDTO
    {
        int _MaVe;
        int _MaLoaiVe;
        int _MaSuatChieu;
        int _MaKhuyenMai;
        int _MaTaiKhoan;
        int _TinhTrang;
        string _ChiSoDay;
        int _ChiSoHang;
        double _ThanhTien;

        public VeDTO(SP_GET_TOANBO_VE_THEO_SUATCHIEUResult item)
        {
            _ChiSoDay = item.ChiSoDay;
            _ChiSoHang = item.ChiSoHang.Value;

            if (item.MaKhuyenMai != null)
            {
                _MaKhuyenMai = item.MaKhuyenMai.Value;
            }
            else
            {
                _MaKhuyenMai = -1;
            }

            if (item.MaLoaiVe != null)
            {
                _MaLoaiVe = item.MaLoaiVe.Value;
            }
            else
            {
                _MaLoaiVe = -1;
            }


            if (item.MaTaiKhoan != null)
            {
                _MaTaiKhoan = item.MaTaiKhoan.Value;
            }
            else
            {
                _MaTaiKhoan = -1;
            }
            _MaSuatChieu = item.MaSuatChieu.Value;

            _MaVe = item.MaVe;
            if (item.ThanhTien != null)
            {
                _ThanhTien = item.ThanhTien.Value;
            }
            else
            {
                _ThanhTien = -1;
            }

            _TinhTrang = item.TinhTrang.Value;
        }

        public VeDTO(SP_GET_TOANBO_VE_CHUADAT_THEO_SUATCHIEUResult item)
        {
            _ChiSoDay = item.ChiSoDay;
            _ChiSoHang = item.ChiSoHang.Value;

            if (item.MaKhuyenMai != null)
            {
                _MaKhuyenMai = item.MaKhuyenMai.Value;
            }
            else
            {
                _MaKhuyenMai = -1;
            }

            if (item.MaLoaiVe != null)
            {
                _MaLoaiVe = item.MaLoaiVe.Value;
            }
            else
            {
                _MaLoaiVe = -1;
            }


            if (item.MaTaiKhoan != null)
            {
                _MaTaiKhoan = item.MaTaiKhoan.Value;
            }
            else
            {
                _MaTaiKhoan = -1;
            }
            _MaSuatChieu = item.MaSuatChieu.Value;

            _MaVe = item.MaVe;
            if (item.ThanhTien != null)
            {
                _ThanhTien = item.ThanhTien.Value;
            }
            else
            {
                _ThanhTien = -1;
            }

            _TinhTrang = item.TinhTrang.Value;
        }

        public VeDTO()
        {
            _ChiSoDay = "";
            _ChiSoHang = 0;
            _MaKhuyenMai = 0;
            _MaLoaiVe = 0;
            _MaSuatChieu = 0;
            _MaTaiKhoan = 0;
            _MaVe = 0;
            _ThanhTien = 0;
            _TinhTrang = 0;
        }

        public VeDTO(SP_GET_TICKET_BYIDResult item)
        {
            // TODO: Complete member initialization
            _ChiSoDay = item.ChiSoDay;
            _ChiSoHang = item.ChiSoHang.Value;

            if (item.MaKhuyenMai != null)
            {
                _MaKhuyenMai = item.MaKhuyenMai.Value;
            }
            else
            {
                _MaKhuyenMai = -1;
            }

            if (item.MaLoaiVe != null)
            {
                _MaLoaiVe = item.MaLoaiVe.Value;
            }
            else
            {
                _MaLoaiVe = -1;
            }


            if (item.MaTaiKhoan != null)
            {
                _MaTaiKhoan = item.MaTaiKhoan.Value;
            }
            else
            {
                _MaTaiKhoan = -1;
            }
            _MaSuatChieu = item.MaSuatChieu.Value;

            _MaVe = item.MaVe;
            if (item.ThanhTien != null)
            {
                _ThanhTien = item.ThanhTien.Value;
            }
            else
            {
                _ThanhTien = -1;
            }

            _TinhTrang = item.TinhTrang.Value;
        }

        public VeDTO(SP_GET_TICKETBOOOKED_BYIDResult item)
        {
            // TODO: Complete member initialization
            _ChiSoDay = item.ChiSoDay;
            _ChiSoHang = item.ChiSoHang.Value;

            if (item.MaKhuyenMai != null)
            {
                _MaKhuyenMai = item.MaKhuyenMai.Value;
            }
            else
            {
                _MaKhuyenMai = -1;
            }

            if (item.MaLoaiVe != null)
            {
                _MaLoaiVe = item.MaLoaiVe.Value;
            }
            else
            {
                _MaLoaiVe = -1;
            }


            if (item.MaTaiKhoan != null)
            {
                _MaTaiKhoan = item.MaTaiKhoan.Value;
            }
            else
            {
                _MaTaiKhoan = -1;
            }
            _MaSuatChieu = item.MaSuatChieu.Value;

            _MaVe = item.MaVe;
            if (item.ThanhTien != null)
            {
                _ThanhTien = item.ThanhTien.Value;
            }
            else
            {
                _ThanhTien = -1;
            }

            _TinhTrang = item.TinhTrang.Value;
        }


        public double ThanhTien
        {
            get { return _ThanhTien; }
            set { _ThanhTien = value; }
        }

        public int ChiSoHang
        {
            get { return _ChiSoHang; }
            set { _ChiSoHang = value; }
        }

        public string ChiSoDay
        {
            get { return _ChiSoDay; }
            set { _ChiSoDay = value; }
        }

        public int TinhTrang
        {
            get { return _TinhTrang; }
            set { _TinhTrang = value; }
        }

        public int MaTaiKhoan
        {
            get { return _MaTaiKhoan; }
            set { _MaTaiKhoan = value; }
        }

        public int MaKhuyenMai
        {
            get { return _MaKhuyenMai; }
            set { _MaKhuyenMai = value; }
        }

        public int MaSuatChieu
        {
            get { return _MaSuatChieu; }
            set { _MaSuatChieu = value; }
        }

        public int MaLoaiVe
        {
            get { return _MaLoaiVe; }
            set { _MaLoaiVe = value; }
        }

        public int MaVe
        {
            get { return _MaVe; }
            set { _MaVe = value; }
        }
    }
}